<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<title>修改商品信息</title>
	<meta name="description" content="Common form elements and layouts" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<!-- basic styles -->
	<hdjs/>
	<link href="__PUBLIC__/css/common.css" rel="stylesheet" />
	<link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet" />
	<link href="__PUBLIC__/css/bootstrap-responsive.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="__PUBLIC__/css/font-awesome.min.css" />
	<!--[if IE 7]>
	  <link rel="stylesheet" href="__PUBLIC__/css/font-awesome-ie7.min.css" />
	<![endif]-->
	<!-- page specific plugin styles -->
	<link rel="stylesheet" href="__PUBLIC__/css/jquery-ui-1.10.2.custom.min.css" />
	<link rel="stylesheet" href="__PUBLIC__/css/chosen.css" />
	<link rel="stylesheet" href="__PUBLIC__/css/datepicker.css" />
	<link rel="stylesheet" href="__PUBLIC__/css/bootstrap-timepicker.css" />
	<link rel="stylesheet" href="__PUBLIC__/css/daterangepicker.css" />
	<link rel="stylesheet" href="__PUBLIC__/css/colorpicker.css" />
	<!-- ace styles -->
	<link rel="stylesheet" href="__PUBLIC__/css/ace.min.css" />
	<link rel="stylesheet" href="__PUBLIC__/css/ace-responsive.min.css" />
	<link rel="stylesheet" href="__PUBLIC__/css/ace-skins.min.css" />
	<!--[if lt IE 9]>
	  <link rel="stylesheet" href="__PUBLIC__/css/ace-ie.min.css" />
	<![endif]-->
</head>
<body>

	<div class="container-fluid" id="main-container">
		<a href="#" id="menu-toggler"><span></span></a><!-- menu toggler -->
		<!-- PAGE CONTENT BEGINS HERE -->
		<form class="form-horizontal" method="post" enctype="multipart/form-data">
			<div class="table-header" style="position:fixed;width:100%;z-index:9999;">
				商品管理 | <a style="font-size:14px;" href="">编辑商品</a>
			</div>
			<div class="control-group">
				<label class="control-label" for="form-field-1"></label>
				<div class="controls">
					<input type="text" id="form-field-1">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="gname">商品名称</label>
				<div class="controls">
					<input type="text" placeholder="请填入商品名称" name="gname">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">发布人</label>
				<div class="controls">
					<input readonly type="text" value="{$hd.session.qname}" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="gprice">商品价格</label>
				<div class="controls">
					<input type="text" placeholder="请填入商品价格" name="gprice">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="gpmt_price">促销价格</label>
				<div class="controls">
					<input type="text" placeholder="请填入促销价格" name="gpmt_price">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="gplace">来源地</label>
				<div class="controls">
					<select class="chzn-select" data-placeholder="选择来源地.." name="gplace">
						<option value=""></option>
						<option value='湖北'>湖北</option>
						<option value='海南'>海南</option>
						<option value='北京'>北京</option>
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="gpmt_price">搜索关键词</label>
				<div class="controls">
					<input type="text" placeholder="最多填写5个,以逗号隔开" name="gpmt_price">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="gsort">商品排序</label>
				<div class="controls">
					<input class="input-medium" type="text" placeholder="当前最大序号:{$maxSort}" name="gsort">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="gis_shelves">是否上架</label>
				<div class="controls">
					<input name="gis_shelves" class="ace-switch ace-switch-5" type="checkbox" checked=""/><span class="lbl"></span>
				</div>
			</div>
			<div class="control-group" id="goods-value">
				<label class="control-label" for="qm_type_tid">选择类型</label>
				<div class="controls" style="margin-bottom:10px;" id="self-value">
					<select name="qm_type_tid">
						<option value=0 class="Types">请选择商品类型</option>
						<foreach from="$type" value="$value">
							<option value="{$value.tid}" class="Typest">{$value.ttitle}</option>
						</foreach>
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="qm_category_cid">选择分类</label>
				<div class="controls">
					<select>
						<option value="0" class="Cates">请选择顶级分类(必选)</option>
						<foreach from="$topCate" value="$value">
							<option value="{$value.cid}" class="Catest">{$value.cname}</option>
						</foreach>
					</select>
					<select name="qm_category_cid" class="subCateBox">
						<option value="0" class="Cater">请选择二级分类(必选)</option>
					</select>
					<select name="qm_category_cid" class="lastCateBox">
						<option value="0">请选择三级分类</option>
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="qm_channel_nid">所属栏目</label>
				<div class="controls">
					<foreach from="$chan" value="$value">
					<label style="display:inline;">
						<input name="qm_channel_nid" type="radio" value="{$value.nid}"/><span class="lbl"> {$value.nname}</span>
					</label>
					</foreach>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">首页推荐</label>
				<div class="controls index-goods">
					<label style="display:inline;">
						<input name="gattr[]" type="checkbox" value="首页轮播"/><span class="lbl"> 首页轮播</span>
					</label>
					<label style="display:inline;">
						<input name="gattr[]" type="checkbox" value="当日精选"/><span class="lbl"> 当日精选</span>
					</label>
					<label style="display:inline;">
						<input name="gattr[]" type="checkbox" value="热门推荐"/><span class="lbl"> 热门推荐</span>
					</label>
					<label style="display:inline;">
						<input name="gattr[]" type="checkbox" value="天天特价"/><span class="lbl"> 天天特价</span>
					</label>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="gone_words">一句话名称</label>
				<div class="controls one-word" style='width:400px;padding-top:5px'>
					<span style="color:red;font-size:14px;vertical-align:middle;display:block;">只有选择了首页推荐属性,才需要填入一句话名称</span>
					<input type="text" placeholder="限10个字符" name="gone_words" style="display:none">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="gindex_img">首页图片</label>
				<div class="controls index-upload" style='width:400px;padding-top:5px'>
					<!-- <input type="file" name="gindex_img"/> -->
					<span style="color:red;font-size:14px;vertical-align:middle;display:block;">只有选择了首页推荐属性,才需要上传首页图片</span>
					<input type="file" name="gindex_img" style="display:none"/>
					<!-- <upload size='0.3' type='jpg,png,gif' limit='1' name='gindex_img' water="false"/> -->
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="gthumb_img">列表页图片</label>
				<div class="controls" style='width:400px;'>
					<input type="file" name="gthumb_img"/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="dbig_img">详情页图片</label>
				<div class="controls" style='width:400px;'>
					<input type="file" name="dbig_img"/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="done_sentence">一句话介绍</label>
				<div class="controls">
					<textarea class="limited" id="done_sentence" data-maxlength="200" style="width:500px;" placeholder="请用一句话介绍你的商品,限200字(必填)" name="done_sentence"></textarea>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="ddescription">商品描述</label>
				<div class="controls">
					<ueditor width='850' height='300' name="ddescription" style="1"/>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-info" type="submit"><i class="icon-ok"></i> 提交</button>
				&nbsp; &nbsp; &nbsp;
				<button class="btn" type="reset"><i class="icon-undo"></i> 重置</button>
			</div>
		</form>
		<!-- PAGE CONTENT ENDS HERE -->		  
	</div><!-- #main-content -->
	<a href="#" id="btn-scroll-up" class="btn btn-small btn-inverse">
		<i class="icon-double-angle-up icon-only"></i>
	</a>
	<!-- basic scripts -->
	<script type="text/javascript">
		//只有选择了首页推荐属性才出现输入一句话标题和上传首页图片上传框
		$(function(){
			var chosen=$('.index-goods').find('input[type=checkbox]');
			chosen.click(function() {
				var c=false;
				$.each(chosen, function(index, val) {
					var test=$(this).attr('checked');
					if (test=='checked') {
						c=true;
					}		
				});
				var uploadBox=$('.index-upload');
				var oneWord=$('.one-word');
				if(c){
					uploadBox.css('padding-top', '0px');
					uploadBox.find('span').hide();
					uploadBox.find('input[type=file]').show();
					oneWord.find('span').hide();
					oneWord.find('input[type=text]').show();
				}else{
					uploadBox.css('padding-top', '5px');
					uploadBox.find('span').show();
					uploadBox.find('input[type=file]').hide();
					oneWord.find('span').show();
					oneWord.find('input[type=text]').hide();
				}
			});
		})
		//点击获得子分类
		$(function(){
			$('.Cates').click(function() {
				$('.subCateBox').empty();
				$('.subCateBox').append("<option value='0'>请选择二级分类(必选)</option>");
				$('.lastCateBox').empty();
				$('.lastCateBox').append("<option value='0'>请选择三级分类</option>");
			});
			$('.Catest').click(function() {
				var cid=$(this).val();
				$('.subCateBox').empty();
				$('.subCateBox').append("<option value='0'>请选择二级分类(必选)</option>");
				$.ajax({
					url : APP + "&c=Goods&m=ajax_get_subcate&cid=" +cid,
					dataType:'json',
					success:function(data){
						$.each(data, function(index, val) {
							$('.subCateBox').append(" <option class='Cater' value="+val.cid+">"+val.cname+"</option>");
						});
					}
				})
			});
			$('.Cater').live('click', function() {
				var cid=$(this).val();
				$('.lastCateBox').empty();
				$('.lastCateBox').append("<option value='0'>请选择三级分类</option>");
				$.ajax({
					url : APP + "&c=Goods&m=ajax_get_subcate&cid=" +cid,
					dataType:'json',
					success:function(data){
						$.each(data, function(index, val) {
							$('.lastCateBox').append(" <option value="+val.cid+">"+val.cname+"</option>");
						});
					}
				})
			});
		})
	</script>
	
	<script src="__PUBLIC__/js/bootstrap.min.js"></script>
	<!-- page specific plugin scripts -->
	
	<!--[if lt IE 9]>
	<script type="text/javascript" src="__PUBLIC__/js/excanvas.min.js"></script>
	<![endif]-->
	<script type="text/javascript" src="__PUBLIC__/js/jquery-ui-1.10.2.custom.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery.ui.touch-punch.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/chosen.jquery.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/fuelux.spinner.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/bootstrap-datepicker.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/bootstrap-timepicker.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/date.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/daterangepicker.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/bootstrap-colorpicker.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery.knob.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery.autosize-min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery.inputlimiter.1.3.1.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery.maskedinput.min.js"></script>
	<!-- ace scripts -->
	<script src="__PUBLIC__/js/ace-elements.min.js"></script>
	<script src="__PUBLIC__/js/ace.min.js"></script>
	<!-- inline scripts related to this page -->
	
	<script type="text/javascript">
		$(function() {

			$('#id-disable-check').on('click', function() {
				var inp = $('#form-input-readonly').get(0);
				if(inp.hasAttribute('disabled')) {
					inp.setAttribute('readonly' , 'true');
					inp.removeAttribute('disabled');
					inp.value="This text field is readonly!";
				}
				else {
					inp.setAttribute('disabled' , 'disabled');
					inp.removeAttribute('readonly');
					inp.value="This text field is disabled!";
				}
			});


			$(".chzn-select").chosen(); 
			$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
			
			$('.ace-tooltip').tooltip();
			$('.ace-popover').popover();
			
			$('textarea[class*=autosize]').autosize({append: "\n"});
			$('textarea[class*=limited]').each(function() {
				var limit = parseInt($(this).attr('data-maxlength')) || 100;
				$(this).inputlimiter({
					"limit": limit,
					remText: '%n character%s remaining...',
					limitText: 'max allowed : %n.'
				});
			});
			
			$.mask.definitions['~']='[+-]';
			$('.input-mask-date').mask('99/99/9999');
			$('.input-mask-phone').mask('(999) 999-9999');
			$('.input-mask-eyescript').mask('~9.99 ~9.99 999');
			$(".input-mask-product").mask("a*-999-a999",{placeholder:" ",completed:function(){alert("You typed the following: "+this.val());}});
			
			
			
			$( "#input-size-slider" ).css('width','200px').slider({
				value:1,
				range: "min",
				min: 1,
				max: 6,
				step: 1,
				slide: function( event, ui ) {
					var sizing = ['', 'input-mini', 'input-small', 'input-medium', 'input-large', 'input-xlarge', 'input-xxlarge'];
					var val = parseInt(ui.value);
					$('#form-field-4').attr('class', sizing[val]).val('.'+sizing[val]);
				}
			});
			$( "#input-span-slider" ).slider({
				value:1,
				range: "min",
				min: 1,
				max: 11,
				step: 1,
				slide: function( event, ui ) {
					var val = parseInt(ui.value);
					$('#form-field-5').attr('class', 'span'+val).val('.span'+val).next().attr('class', 'span'+(12-val)).val('.span'+(12-val));
				}
			});
			
			
			var $tooltip = $("<div class='tooltip right in' style='display:none;'><div class='tooltip-arrow'></div><div class='tooltip-inner'></div></div>").appendTo('body');
			$( "#slider-range" ).css('height','200px').slider({
				orientation: "vertical",
				range: true,
				min: 0,
				max: 100,
				values: [ 17, 67 ],
				slide: function( event, ui ) {
					var val = ui.values[$(ui.handle).index()-1]+"";
					
					var pos = $(ui.handle).offset();
					$tooltip.show().children().eq(1).text(val);		
					$tooltip.css({top:pos.top - 10 , left:pos.left + 18});
					
					//$(this).find('a').eq(which).attr('data-original-title' , val).tooltip('show');
				}
			});
			$('#slider-range a').tooltip({placement:'right', trigger:'manual', animation:false}).blur(function(){
				$tooltip.hide();
				//$(this).tooltip('hide');
			});
			//$('#slider-range a').tooltip({placement:'right', animation:false});
			
			$( "#slider-range-max" ).slider({
				range: "max",
				min: 1,
				max: 10,
				value: 2,
				//slide: function( event, ui ) {
				//	$( "#amount" ).val( ui.value );
				//}
			});
			//$( "#amount" ).val( $( "#slider-range-max" ).slider( "value" ) );
			
			$( "#eq > span" ).css({width:'90%', float:'left', margin:'15px'}).each(function() {
				// read initial values from markup and remove that
				var value = parseInt( $( this ).text(), 10 );
				$( this ).empty().slider({
					value: value,
					range: "min",
					animate: true
					
				});
			});
			
			$('#id-input-file-1 , #id-input-file-2').ace_file_input({
				no_file:'No File ...',
				btn_choose:'Choose',
				btn_change:'Change',
				droppable:false,
				onchange:null,
				thumbnail:false //| true | large
				//whitelist:'gif|png|jpg|jpeg'
				//blacklist:'exe|php'
				//onchange:''
				//
			});
			
			$('#id-input-file-3').ace_file_input({
				style:'well',
				btn_choose:'Drop files here or click to choose',
				btn_change:null,
				no_icon:'icon-cloud-upload',
				droppable:true,
				onchange:null,
				thumbnail:'small',
				before_change:function(files, dropped) {
					/**
					if(files instanceof Array || (!!window.FileList && files instanceof FileList)) {
						//check each file and see if it is valid, if not return false or make a new array, add the valid files to it and return the array
						//note: if files have not been dropped, this does not change the internal value of the file input element, as it is set by the browser, and further file uploading and handling should be done via ajax, etc, otherwise all selected files will be sent to server
						//example:
						var result = []
						for(var i = 0; i < files.length; i++) {
							var file = files[i];
							if((/^image\//i).test(file.type) && file.size < 102400)
								result.push(file);
						}
						return result;
					}
					*/
					return true;
				}
				/*,
				before_remove : function() {
					return true;
				}*/
			}).on('change', function(){
				//console.log($(this).data('ace_input_files'));
				//console.log($(this).data('ace_input_method'));
			});
			
			$('#spinner1').ace_spinner({value:0,min:0,max:200,step:10, btn_up_class:'btn-info' , btn_down_class:'btn-info'})
			.on('change', function(){
				//alert(this.value)
			});
			$('#spinner2').ace_spinner({value:0,min:0,max:10000,step:100, icon_up:'icon-caret-up', icon_down:'icon-caret-down'});
			$('#spinner3').ace_spinner({value:0,min:-100,max:100,step:10, icon_up:'icon-plus', icon_down:'icon-minus', btn_up_class:'btn-success' , btn_down_class:'btn-danger'});
			
			/**
			var stubDataSource = {
			data: function (options, callback) {
				setTimeout(function () {
					callback({
						data: [
							{ name: 'Test Folder 1', type: 'folder', additionalParameters: { id: 'F1' } },
							{ name: 'Test Folder 1', type: 'folder', additionalParameters: { id: 'F2' } },
							{ name: 'Test Item 1', type: 'item', additionalParameters: { id: 'I1' } },
							{ name: 'Test Item 2', type: 'item', additionalParameters: { id: 'I2' } }
						]
					});
				}, 0);
			}
			};
			$('#MyTree').tree({ dataSource: stubDataSource , multiSelect:true })
			*/
			
			$('.date-picker').datepicker();
			$('#timepicker1').timepicker({
				minuteStep: 1,
				showSeconds: true,
				showMeridian: false
			});
			
			$('#id-date-range-picker-1').daterangepicker();
			
			$('#colorpicker1').colorpicker();
			$('#simple-colorpicker-1').ace_colorpicker();	
		$(".knob").knob();

			});
	</script>
</body>
</html>
